thread: add pthread-based threading module#72
thread: add pthread-based threading module#72arkjedrz wants to merge 1 commit intoeclipse-score:mainfrom
pthread-based threading module#72Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
There was a problem hiding this comment.
Pull request overview
Adds a new thread Rust crate that provides a pthread-based, parameterizable thread-spawning API (scheduler policy/priority, CPU affinity, stack size) and integrates it into the workspace build (Cargo + Bazel).
Changes:
- Introduce
threadcrate withspawn+JoinHandle, plusThreadParameters/SchedulerParameters. - Implement
pthread_attr_*configuration for scheduling, affinity, and stack size. - Register the crate in the workspace (
Cargo.toml,Cargo.lock) and Bazel (src/thread/BUILD).
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/thread/thread.rs |
Core pthread-based implementation and unit tests. |
src/thread/parameters.rs |
Public parameter types for scheduler/affinity/stack size, plus tests. |
src/thread/lib.rs |
Crate module wiring and public re-exports. |
src/thread/Cargo.toml |
New crate manifest using workspace libc. |
src/thread/BUILD |
Bazel targets for the new Rust library and its tests. |
Cargo.toml |
Add src/thread to workspace members/default-members and deps. |
Cargo.lock |
Lockfile updates for new thread crate and libc. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
600faab to
cadcd38
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new thread workspace crate providing a pthread-backed API to spawn threads with configurable scheduler policy/priority, CPU affinity, and stack size.
Changes:
- Introduces a new
threadcrate withspawn,JoinHandle, andThreadParameters/SchedulerParameters. - Adds a minimal POSIX/pthread FFI layer and unit tests for attributes/spawn behavior.
- Registers the new crate in the workspace (Cargo + Bazel).
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/thread/thread.rs | Implements pthread-backed spawning/joining + attribute handling and tests. |
| src/thread/posix.rs | Adds POSIX/pthread FFI declarations and CPU set helpers. |
| src/thread/parameters.rs | Adds public parameter types for scheduler/affinity/stack size + tests. |
| src/thread/lib.rs | Crate module wiring and public re-exports. |
| src/thread/Cargo.toml | New crate manifest and dependencies. |
| src/thread/BUILD | Bazel targets for library and unit tests. |
| Cargo.toml | Adds src/thread to workspace members and dependencies. |
| Cargo.lock | Records resolved workspace dependency updates (e.g., libc). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| if rc != 0 { | ||
| panic!("pthread_attr_destroy failed, rc: {rc}"); | ||
| } | ||
| } | ||
| } | ||
|
|
| /// An owned permission to join on a thread (block on its termination). | ||
| pub struct JoinHandle<T> { | ||
| thread: Thread, | ||
| _marker: PhantomData<T>, | ||
| } |
cadcd38 to
915a0b6
Compare
Parametrizable threading module.
915a0b6 to
237f7fb
Compare
| let result = catch_unwind(AssertUnwindSafe(move || (data.f)())); | ||
| match result { | ||
| Ok(value) => Box::into_raw(Box::new(value)).cast(), | ||
| Err(_) => std::process::abort(), |
There was a problem hiding this comment.
Replace with panic containing explanation what happened.
Parametrizable threading module.
Notes for Reviewer
Pre-Review Checklist for the PR Author
Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References
Closes #